import { sendRequest } from '@/http';

const baseUrl = '/admin/inst';

/**
 * 查询职位列表
 * @returns
 */
export const queryInstPositions = (name = '') => {
  return sendRequest({
    url: `${baseUrl}/queryInstPositions`,
    method: 'get',
    params: { name },
  });
};

/**
 * 创建职位
 * @param position
 * @returns
 */
export const createPosition = (position: { name: string }) => {
  return sendRequest({
    url: `${baseUrl}/createPosition`,
    method: 'post',
    data: position,
  });
};

/**
 * 编辑岗位
 * @param position
 * @returns
 */
export const updatePosition = (position: { id: string; name: string }) => {
  return sendRequest({
    url: `${baseUrl}/updatePosition`,
    method: 'post',
    data: position,
  });
};

/**
 * 删除岗位
 * @param id 岗位ID
 * @returns
 */
export const deletePosition = (id: string) => {
  return sendRequest({
    url: `${baseUrl}/deletePosition`,
    method: 'post',
    data: { id },
  });
};
